package com.setDemo.treeset;

import java.util.TreeSet;

/**
 * @Author milian
 * @Date 2021/7/26 0026 17:00
 */
public class demo2 {
    public static void main(String[] args) {
        TreeSet<Student> treeSet = new TreeSet<>();
        Student s1 = new Student("李一", 13);
        Student s2 = new Student("李二", 12);
        Student s3 = new Student("李三", 11);
        treeSet.add(s1);
        treeSet.add(s2);
        treeSet.add(s3);
        for (Student s:treeSet
             ) {
            System.out.println(s);
        }
    }
}
